package com.bobo.demo.Thread;

public class TestPriority implements Runnable{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+"->"+Thread.currentThread().getPriority());
    }

    public static void main(String[] args) {
        System.out.println("main执行");
        TestPriority testPriority = new TestPriority();
        Thread t1 = new Thread(testPriority);
        Thread t2 = new Thread(testPriority);
        Thread t3 = new Thread(testPriority);
        Thread t4 = new Thread(testPriority);

        t1.setPriority(4);
        t1.start();
        t2.setPriority(Thread.MIN_PRIORITY);//MIN_PRIORITY = 1
        t2.start();
        t3.setPriority(Thread.MAX_PRIORITY);//MAX_PRIORITY) = 10
        t3.start();
        t4.setPriority(7);
        t4.start();
    }

}
